Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(etag): change where to check for crypto #3916

Merged
merged 5 commits into from
Feb 13, 2025

Conversation

EdamAme-x
Copy link
Contributor

@EdamAme-x EdamAme-x commented Feb 12, 2025

This PR allows users to specify a hash generation function even in environments where there is no crypto, so the place to check for crypto changes.
#3832

The author should do the following, if applicable

  • Add tests
  • Run tests
  • bun run format:fix && bun run lint:fix to format the code
  • Add TSDoc/JSDoc to document the code

@EdamAme-x EdamAme-x changed the title fix(etag): remove parts that may cause unintended behavior fix(etag): change where to check for crypto Feb 12, 2025
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.31%. Comparing base (8340a7b) to head (2cd2573).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3916      +/-   ##
==========================================
+ Coverage   91.28%   91.31%   +0.03%     
==========================================
  Files         168      168              
  Lines       10757    10673      -84     
  Branches     3166     3053     -113     
==========================================
- Hits         9819     9746      -73     
+ Misses        937      926      -11     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yusukebe
Copy link
Member

Hi @EdamAme-x

Do you mean this PR will resolve #3914? If so, I think this approach is good.

@EdamAme-x
Copy link
Contributor Author

The context is slightly different.

The main direction of this PR is to solve the problem of checking for the presence of a crypto api, even though it uses a hash generation method that does not use a crypto api.

Of course, as you may be thinking, this PR may improve compatibility as a side effect.

@yusukebe
Copy link
Member

@EdamAme-x

I understood! But, to fix #3914, it will be good to delete import crypto from 'node:crypto' following the comment

@EdamAme-x
Copy link
Contributor Author

Okay.
@yusukebe This PR should be able to merge.
Can you review this?

Copy link
Member

@usualoma usualoma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @EdamAme-x. Thank you for creating a pull request.

There is no need to adopt my branch as they are, but I would like to convey the following in my comments.

EdamAme-x/hono@fix/etag-if-bug...usualoma:hono:fix/etag-if-bug-2

src/middleware/etag/digest.ts Outdated Show resolved Hide resolved
src/middleware/etag/index.ts Outdated Show resolved Hide resolved
@EdamAme-x
Copy link
Contributor Author

ready

@usualoma
Copy link
Member

@EdamAme-x Thank you!

Copy link
Member

@yusukebe yusukebe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@yusukebe yusukebe merged commit d6757c7 into honojs:main Feb 13, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants